<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

      <button id="btnBai"> 登录 </button>

      <button id="btnPrev">上一页</button>
</body>
<script>

   var btnBai = document.getElementById('btnBai');

   btnBai.onclick = function (){

     //相对路径
    //  window.location.href = 'baidu.com';
      location.href ='index.html';

    // window.location.href = ' https://www.baidu.com/';
   }


   var btnPrev=document.getElementById('btnPrev');

   btnPrev.onclick  = function (){
        history.back();
   }


</script>

</html>